<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>


  //定义⼀个stu学⽣对象，内有：两个属性、⼀个⽅法。
  const stu = {
    name:"张三",
    likes:['吃饭','睡觉','敲代码'],
    printLikes:function(){
      let self = this;
//使⽤map遍历likes属性，并输出信息
      this.likes.map(function(like){
         function all(like){
           console.log(self .name+":"+like);
         }
         all(like);
      });
    }
  };

  stu.printLikes();
</script>

</body>
</html>